package com.lenovo.testreport.user.controller;

import com.lenovo.session.LevelControl;
import com.lenovo.testreport.user.model.MessageCenter;
import com.lenovo.testreport.user.service.MessageService;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author CJF
 * @date 2018/11
 * <p>
 * 消息中心查看消息记录
 */
@Controller
@RequestMapping("/Message_Record")
public class MessageRecord {

    @Autowired
    private LevelControl LEVELCONTROL;

    @Autowired
    private MessageService service;

    @RequestMapping("/FindAllMessage")
    public @ResponseBody
    List<MessageCenter> FindAllMessage(HttpServletRequest request) {

        return service.FindAllMessageRecord();
    }

    @RequestMapping("/FindMessageByType")
    public @ResponseBody
    List<MessageCenter> FindMessageByType(HttpServletRequest request) {

        return service.FindMessageRecordByType(request.getParameter("type"));
    }

}
